from django.db import models


# 职业规划测试
class QuestionType(models.Model):
    questiontype_id = models.BigAutoField(db_column='QuestionType_Id', primary_key=True)
    typename = models.CharField(db_column='TypeName', max_length=100)
    introduce = models.TextField(db_column='Introduce', blank=True, null=True)
    num = models.IntegerField(db_column='Num', blank=True, null=True)
    needtime = models.IntegerField(db_column='NeedTime', blank=True, null=True)
    isfree = models.BooleanField(db_column='IsFree', blank=True, default=False)
    price = models.FloatField(db_column='Price', blank=True, null=True)
    gentime = models.DateTimeField(db_column='GenTime')
    edittime = models.DateTimeField(db_column='EditTime')

    class Meta:
        db_table = 'questiontype'
        verbose_name_plural = '职业规划题型表'


class SubjectTitle(models.Model):
    SubjectTitle_id = models.BigAutoField(db_column='SubjectTitle_id', primary_key=True)
    QuestionType_id = models.ForeignKey('QuestionType', models.CASCADE, db_column='QuestionType_id',
                                        related_name='question_subbject')
    Title = models.TextField(db_column='Title')
    GenTime = models.DateTimeField(db_column='GenTime')
    EditTime = models.DateTimeField(db_column='EditTime')

    class Meta:
        db_table = 'subjecttile'
        verbose_name_plural = '题目表'


class Answertable(models.Model):
    AnswerTable_id = models.BigAutoField(db_column='AnswerTable_id', primary_key=True)
    SubjectTitle_Id = models.ForeignKey('SubjectTitle', models.CASCADE, db_column='SubjectTitle_Id', blank=True,
                                        null=True, related_name='subject_answer')
    Item = models.CharField(db_column='Item', max_length=1)
    ItemContent = models.CharField(db_column='ItemContent', max_length=200)
    ItemCA = models.CharField(db_column='ItemCA', max_length=12, blank=True, null=True)
    GenTime = models.DateTimeField(db_column='GenTime')
    EditTime = models.DateTimeField(db_column='EditTime')

    class Meta:
        db_table = 'answertable'
        verbose_name_plural = '答案表'
